#include <iostream>
#include <fstream>
#include <ctime>
#include <vector>
using namespace std;
vector <int> bbl(vector <int> bb){
  for(int i = 0; i < bb.size(); i++) {
    int k=0;
    for(int j = 0; j < bb.size()-1-i; j++) {
      if (bb[j] > bb[j + 1]) {
        int b = bb[j]; 
        bb[j] = bb[j + 1]; 
        bb[j + 1] = b; 
        k++;
      }
    }
if (k==0) break;
}
return bb ;
  }
int main() {
  ifstream f ;
  f.open("m1.sorted.txt");
    vector <int> bb;
  int x ;
  while (f>>x) {
    bb.push_back(x);
  }
double start_time = clock();
  bb = bbl(bb);
double finish_time = clock();
cout << " m1.sorted.txt " << (finish_time - start_time) / 1000 << " millisecond " << endl; 
  
  ifstream f2 ;
    f2.open("m2_reversed.txt");
      vector <int> bub;
    int y ;
    while (f2>>y) {
      bub.push_back(y);
    }
  double start_time2 = clock();
    bub = bbl(bub);
  double finish_time2 = clock();
  cout << " m2_reversed.txt " << (finish_time2 - start_time2) / 1000 << " millisecond " << endl; 

  ifstream f3;
      f3.open("m3_shuffle.txt");
        vector <int> bu;
      int z ;
      while (f3>>z) {
        bu.push_back(z);
      }
    double start_time3 = clock();
      bu = bbl(bu);
    double finish_time3 = clock();
    cout << " m3_shuffle.txt " << (finish_time3 - start_time3) / 1000 << " millisecond " << endl; 
  }

  
